package com.llt.chatroom.service;

import com.llt.chatroom.mapper.SessionMapper;
import com.llt.chatroom.model.MessageSessionUser;
import com.llt.chatroom.model.Friend;
import com.llt.chatroom.model.MessageSession;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SessionService {

    @Resource
    SessionMapper sessionMapper;

    public List<Integer> getSessionIdByUserId(int userId) {
        return sessionMapper.getSessionIdByUserId(userId);
    }

    public List<Friend> getFriendsBySessionId(int sessionId, int selfUserId) {
        return sessionMapper.getFriendsBySessionId(sessionId, selfUserId);
    }

    public void addMessageSession(MessageSession messageSession) {
        sessionMapper.addMessageSession(messageSession);
    }

    public void addMessageSessionUser(MessageSessionUser messageSessionUser) {
        sessionMapper.addMessageSessionUser(messageSessionUser);
    }
}
